import subprocess

# 安装基础软件：pip install  allure-pytest Appium-Python-Client pytest 

# 测试报告目录
alluredir = r"D:\download\reports\allure\allure-results"
allure_reports = r"D:\download\reports\allure\allure-reports"
allure_reports_url = "139.159.214.157"
allure_reports_url_port = "8010"

# 设备平台和品牌模型
platform_brand_model = {
    "Android": {
        "小米": ["xiaomi 11"]
    }
}

# 其他固定参数
automation_name = "UiAutomator2"
webdriver_url_appium = "localhost:4723" 
app_url = "D:\project\vscode\himart-test\tests\mobile_tests\resources\himart.apk" 
device_name = "192.168.31.11:5555" 
app_package_name = "com.ccloudx.himart"
app_activity_name = "io.dcloud.PandoraEntry"
markers = "regression"
platform_name = "Android"

# 遍历平台和品牌模型
for platform, brands in platform_brand_model.items():
    for brand, models in brands.items():
        for model in models:
            # 构建 pytest 命令
            command = [
            "pytest -m regression --webdriver_url_appium=localhost:4723  --app_activity_name=io.dcloud.PandoraEntry --app_package_name=com.ccloudx.himart  --device_name=192.168.31.11:5555 --app_url=D:\project\vscode\himart-test\tests\mobile_tests\resources\himart.apk  --automation_name=UiAutomator2  --platform_name=Android --alluredir=D:\download\reports\allure\allure-results --allure_reports=D:\download\reports\allure\allure-reports  --allure_reports_url=139.159.214.157  --allure_reports_url_port=8010     D:\project\vscode\himart-test\tests\mobile_tests\tests\functional_tests\test_login.py" 
            ]
            # 执行 pytest 命令
            subprocess.run(command)
            #  allure generate